import request from '@/utils/request'

// 获取面经列表
export const getArticleList = ({ current, pageSize, sorter }) => {
  return request.get('/h5/interview/query', {
    params: {
      current, pageSize, sorter
    }
  })
}
// 获取面经列表（标题搜索功能）
export const getArticleSearch = ({ current, pageSize, stem }) => {
  return request.get('/h5/interview/query', {
    params: {
      current, pageSize, stem
    }
  })
}

// 获取单个面经详情
export const getArticleInfo = id => {
  return request.get('/h5/interview/show', {
    params: { id: id }
  })
}
// 切换点赞
export const updateLike = (id) => {
  return request.post('/h5/interview/opt', {
    id,
    optType: 1 // 喜欢
  })
}
// 切换收藏
export const updateCollect = (id) => {
  return request.post('/h5/interview/opt', {
    id,
    optType: 2 // 收藏
  })
}

// 获取点赞列表
export const getArticleLikeList = ({ page, pageSize }) => {
  return request.get('/h5/interview/opt/list', {
    params: {
      page,
      pageSize,
      optType: 1
    }
  })
}

// 获取收藏列表
export const getArticleCollectList = ({ page, pageSize }) => {
  return request.get('/h5/interview/opt/list', {
    params: {
      page,
      pageSize,
      optType: 2
    }
  })
}
